package com.example.travelservlet.entertainmentLabel.service;

import com.example.travelservlet.entity.EntertainmentLabel;
import com.example.travelservlet.entertainmentLabel.repository.EntertainmentLabelRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 30697
 */
@Service
public class EntertainmentLabelServiceImpl implements EntertainmentLabelService {
    @Autowired
    private EntertainmentLabelRepository entertainmentLabelRepository;

    @Override
    public List<String> listEntertainmentIds(List<String> labelIds) {
        List<EntertainmentLabel> entertainmentLabels = new ArrayList<>();
        for (String labelId:labelIds){
            entertainmentLabels.addAll(entertainmentLabelRepository.findEntertainmentLabelLabelsByLabelId(labelId));
        }
        List<String> entertainmentIds = new ArrayList<>();
        for (EntertainmentLabel entertainmentLabel:entertainmentLabels) {
            entertainmentIds.add(entertainmentLabel.getEntertainmentId());
        }
        return entertainmentIds;
    }
}
